﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RazakiBLL;

namespace RazakiSite.PagesBoss
{
    public partial class StatisticAll : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ConfigControls();
        }

        protected override void ConfigControls()
        {
            UowRazaki uowRazaki = new UowRazaki();

            Dictionary<string, int?> result = uowRazaki.Context.StatisticTotal().ToDictionary(x => x.Key, x => x.Value);

            lblUsers.Text = result["users"].HasValue ? result["users"].Value.ToString() : "-";
            lblVisitors.Text = UtilitiesUI.VisitorsCountManager().ToString();

            lblNew.Text = result["news"].HasValue ? result["news"].Value.ToString() : "-";

            lblForumQuestion.Text = result["forum-questions"].HasValue
                                        ? result["forum-questions"].Value.ToString()
                                        : "-";
            lblForumAnswer.Text = result["forum-answers"].HasValue ? result["forum-answers"].Value.ToString() : "-";
            lblForumOffer.Text = result["forum-offers"].HasValue ? result["forum-offers"].Value.ToString() : "-";

            lblMsgOffer.Text = result["Message-offer"].HasValue ? result["Message-offer"].Value.ToString() : "-";

            lblOrder.Text = result["orders"].HasValue ? result["orders"].Value.ToString() : "-";

            lblPayment.Text = result["payments"].HasValue ? result["payments"].Value.ToString() : "-";

            lblException.Text = result["exceptions"].HasValue ? result["exceptions"].Value.ToString() : "-";
        }

    }
}